import Vue from 'vue'
import Router from 'vue-router'
// import goTo from "vuetify/lib/services/goto";

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  // scrollBehavior: (to, from, savedPosition) => {
  //   let scrollTo = 0
  //
  //   if (to.hash) {
  //     scrollTo = to.hash
  //   } else if (savedPosition) {
  //     scrollTo = savedPosition.y
  //   }
  //
  //   return goTo(scrollTo)
  // },
  routes: [
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/Login.vue')
    },
    {
      path: '/',
      name: 'layout',
      component: () => import('../views/Layout.vue'),
      children: [
        {
          path: '/home',
          name: 'home',
          component: () => import('../views/Home.vue')
        },
        {
          path: '/book',
          name: 'book',
          component: () => import ('../views/book/book.vue')
        },
        {
          path: '/blog',
          name: 'blog',
          component: () => import('../views/blog/blog.vue')
        },
        {
          path: '/doc',
          name: 'doc',
          component: () => import('../views/doc/doc.vue')
        },
        {
          path: '/stock',
          name: 'stock',
          component: () => import('../views/stock/stock.vue'),
          children: [
            {
              path: 'sale',
              name: 'sale',
              component: () => import('../views/stock/sale/sale.vue')
            },
            {
              path: 'inventory',
              name: 'inventory',
              component: () => import('../views/stock/inventory/inventory.vue')
            },
          ]
        },
        {
          path: '/card',
          name: 'card',
          component: () => import('../views/card/card.vue'),
          children: [
            {
              path: 'balance',
              name: 'balance',
              component: () => import('../views/card/balance/balance.vue')
            },
            {
              path: 'profile',
              name: 'profile',
              component: () => import('../views/card/profile/profile.vue')
            },
          ]
        },
        {
          path: '/aqi',
          name: 'aqi',
          component: () => import('../views/aqi/aqi.vue')
        },
        {
          path: '/member',
          name: 'member',
          component: () => import('../views/member/member.vue')
        },
        {
          path: '/forum',
          name: 'forum',
          component: () => import('../views/forum/forum.vue')
        },
      ]
    },
  ]
})
